Entries tagged 'raspberry pi'
Using a Raspberry Pi as a WiFi Hotspot
The wireless router/gateway from our internet provider (Verizon 5G Home) works okay for most things, but it only supports “band steering” aka using the same SSID (wireless network name) for the 2.4 GHz and 5 GHz bands. I’m still using some older Wyze smart plugs that only support 2.4 GHz and for whatever reason they seem to be flaky in such a setup.
I’m running HomeBridge on a Raspberry Pi 4 to bridge between these Wyze devices and HomeKit because we’re an Apple-heavy household. The Pi is connected via ethernet to our internet gateway, so that leaves its WiFi capabilities free to create another bridge. It doesn’t have a keyboard or monitor, so I did all the setup via ssh
.
The first thing to do is to make sure that the WiFi is configured to the correct country so it uses the appropriate channels. You can do this with the raspi-config
program by setting the appropriate value in “Localisation Options” → “WLAN Country.”
$ sudo raspi-config
For the rest, we’re going to use the nmcli
utility which is the command-line interface for the NetworkManager system. I haven’t poked around under the hood much, but the configuration ultimately lives in files under /etc/NetworkManager
.
The first thing we do is create what NetworkManager calls a connection which we’ll use with the WiFi interface, wlan0
.
$ sudo nmcli con add con-name hotspot ifname wlan0 type wifi ssid "Idiot"
This creates a WiFi network named “Idiot,” which is short in my case for “Imperial Dog Internet of Things.” You can name yours whatever you want. That name hotspot
in there could be something else, too, you’ll just need to make sure to change further references to hotspot
below.
You’ll want to secure your WiFi network with a password, so there’s a couple of commands for that:
$ sudo nmcli con modify hotspot wifi-sec.key-mgmt wpa-psk
$ sudo nmcli con modify hotspot wifi-sec.psk 'This is where the password goes'
The first command says we’re going to use a key, and the second configures the password. Substitute your own.
Finally, we need to set the mode on the connection and tell it that we just want to share the Pi’s connection.
$ sudo nmcli con modify hotspot 802-11-wireless.mode ap 802-11-wireless.band bg ipv4.method shared
By only enabling the “bg” band we’re restricting this network to the 2.4 GHz range, which is what I hopes makes the plug(s) happier.
After this, I was just able to reset the smart plug to use the new “Idiot” network and it seems to have been stable for a couple of days.
It is kind of a Rube Goldberg situation where I say “Hey Siri, turn on my desk lamp” and it is sending out that speech to be processed by Apple, deciding what to do, the device that heard it telling the Pi what I wanted, the Pi going out to the Wyze server to tell it what to do, and somehow my smart plug getting notified what to do. It does take a second or two.
(These steps are just a distillation of what is in this article but without a browser-choking number of ads and popups.)
Possible Ideas/Available Materials
The movie Unstrung Heroes is one that occupies a small corner of my brain. The Oscar-nominated soundtrack by Thomas Newman is great, but what has brought it to mind recently was the scenes where the main character is implementing the scientific process inspired by his father of solving problems by making a list of possible ideas and available materials. (I may be remembering this completely wrong — I really should re-watch this.)
Now that the store is behind us, all of the supplies and fixtures and everything else has been sold off or junked or taken home, I find myself in the position where I need to put together my own lists of possible ideas and available materials.
Some of the available materials that I have are some computers: a Dell PowerEdge T30, a Raspberry Pi 4, and a Raspberry Pi 400. I’ve been following along with Nelson’s experiments with Proxmox, thinking that I will try to set that up on the Dell. The Raspberry Pi 4 seems like a good candidate to run Homebridge to connect some of our things to HomeKit. I should probably find a new home for the Raspberry Pi 400. It’s a neat little computer, but I don’t know that it is really useful to me.
I’ve been thinking of moving some or all of the sites I have hosted on virtual servers to the PowerEdge here at home and just having a single virtual server running a caching proxy to actually front everything. None of it is very critical and our internet connection at home is pretty reliable.
But before I dive into all of that too deeply, we have a surplus of available materials here at home now and the priority (aside from the ongoing job search), is to get cleaned up and organized. We are finally sorting through boxes that we have had jammed into corners for years.